import axios from './axios'
import { home,goods, text, topic, catalog, current, login, search, searchList, detail, related, add, goodscount, carList, setChecked, cartdelete, update,clearhistory } from './api'

//  清除历史记录
export function CLEAR(){
    return axios(clearhistory,{
        method:'post'
    })
}

// 步进器
export function UPDATE(data){
    return axios(update,{
        method:'post',
        data
    })
}

// 删除
export function CATRDELETE(data){
    return axios(cartdelete,{
        method:'post',
        data
    })
}

// 选中状态
export function CHECKED(data){
    return axios(setChecked,{
        method:'post',
        data
    })
}

// 购物车列表
export function CARLIST(){
    return axios(carList)
}

// 购物栏数量
export function GOODSSCOUNT(){
    return axios(goodscount)
}

// 添加
export function ADD(data){
    console.log(data);
    return axios(add,{
        method:"post",
        data
    })
}

// 推荐
export function RELATED(id){
    return axios(related+id)
}

// 详情
export function DETAIL(id){
    return axios(detail+id)
}

// 搜索
export function SEARCHLIST(data){
    console.log(data);
    return axios(searchList+data.keyword+'&page='+data.page+'&order='+data.order+'&sort=price')
}

// 搜索
export function SEARCH(){
    return axios(search)
}

// 登录
export function LOGIN(data){
    return axios(login,{
        method:'post',
        data
    })
}

// 分类list
export function CURRENT(id){
    return axios(current + id)
}

// 分类
export function CATALOG(){
    return axios(catalog)
}

// 专题
export function TOPIC(page){
    console.log(page);
    return axios(topic + page + '&size=10')
}

// 列表
export function TEXT(id){
    return axios(text + id + '&page=' + 1 + '&size=' + 1000)
}

// 分类
export function GOODS(id){
    return axios(goods+id)
}

// 首页
export function HOME(){
    return axios(home)
}